package com.soul.dj.util;

import java.util.HashMap;
import java.util.Map;

import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.webkit.JavascriptInterface;
import android.widget.Toast;

/**
 *
 * Title: JavaScriptInterface.java Description:
 *
 * @author Liusong
 * @version V1.0
 */


public class JavaScriptInterface {

    private Handler mHandler;

    /** Instantiate the interface and set the context */
    public JavaScriptInterface(Handler handler) {
        mHandler = handler;
    }

    /** Show a toast from the web page */
    @JavascriptInterface
    public void showToast(final String toast) {
        Log.i("TAG", "调用成功==================》》》》》");
    }

    @JavascriptInterface
    public void callAndroidAction(String action) {
        showToast(action);
        Message msg = Message.obtain();
        msg.what = Integer.valueOf(action);
        mHandler.sendMessage(msg);
    }

}

